#include <stdio.h>

typedef struct {
    char *ch;
    int length;
} Hstring;

void GetNext(char *t, int next[])
{
    int i = 1, j = 0;
    next[1] = 0;
    while (i < 9) {
        if (j == 0 || t[i] == t[j])
        {
            ++i;
            ++j;
            next[i] = j;
        }
        else
            j = next[j];
    }
}

int KMP_StrIndex(const char *s, const char *t, int pos, int next[])
{
    int i = pos, j = 1;
    while (i <= s[0] && j <= t[0])
    {
        if (j == 0 || s[i] == t[i])
            {i++; j++;}
        else
            j = next[j];
    }
    if (j > t[0])
        return (i - t[0]);
    else
        return 0;
}

int main()
{
    
    
/*
    int example_next[10];
    GetNext(t, example_next);

    char *s = "ababbaabbabbcde";

    for (int i = 1; i < 10; i++)
        printf("%d", example_next[i]);
    printf("\n");
*/
//    printf("%d\n", KMP_StrIndex(s, t, 1, example_next));

    return 0;
}